/**
 * @(#) Player.java
 */

package TheRestaurantOwner;

import java.io.*;

public class Player
{
	// Each player in the game has a name.
	private String name;

	public Player( )
	{
		name = input("Enter your name: ", "Player 1");
	}

	public String input( String message )
	{
		if (message != null){
			System.out.print(message);
		}
		
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferedReader = new BufferedReader(reader);
		String line = null;
		try {
			line = bufferedReader.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return line;
	}

	public String input( )
	{
		return input(null);
	}

	public String input( String message, String defValue )
	{
		boolean debug = false;
		if (debug && message != null){
			// Choose default values when debugging
			if (message != null){
				System.out.print(message);
			}
			System.out.println("[debug] " + defValue);
			return defValue;
		}
		
		String inp = input(message + "[" + defValue + "] ");
		if (inp.isEmpty()){
			return defValue;
		}
		return inp;
	}

	public String getName( )
	{
		return name;
	}
}
